try:
    fname = input('Please enter the filename, default(mbox-short.txt)\n')
    if fname == '':
        fname = 'mbox-short.txt'
    fhand = open(fname, 'r')
except Exception as e:
    print('can\'t open the file for', fname)
    exit()

counter = {}
for line in fhand:
    if not line.startswith('From '):
        continue

    words = line.split()
    if len(words) < 1:
        continue

    word = words[1]
    _, utc = word.split('@')
    counter[utc] = counter.get(utc, 0) + 1

print(counter)
